#include "widget.h"
#include "ui_widget.h"
#include<QTimer>
#include<QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timer=new QTimer(this);
    timer->setInterval(0);
    connect(timer,&QTimer::timeout,this,&Widget::updateProgressBar);
    timer->start(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::updateProgressBar()
{
    int value=ui->progressBar->value();
    ui->progressBar->setStyleSheet("QProgressBar::chunk {background-color:#FF0000};");
    if(value>100)
    {
        timer->stop();
        return;
    }
    ui->progressBar->setValue(value+1);
}

